Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
matcher-collection
Advanced tools
The matcher-collection npm package is a utility that allows you to efficiently test if a value matches any of a collection of patterns. It is often used to filter or find items in a list that match certain criteria.
Matching strings against patterns
This feature allows you to create a collection of string patterns and then test if a given string matches any of those patterns. The patterns can include wildcards.
"use strict";
const MatcherCollection = require('matcher-collection');
let matchers = new MatcherCollection(['foo*', 'bar']);
console.log(matchers.match('foobar')); // true
console.log(matchers.match('barbaz')); // true
console.log(matchers.match('qux')); // false
Matching with regular expressions
Matcher-collection can also handle regular expressions, allowing for more complex matching scenarios.
"use strict";
const MatcherCollection = require('matcher-collection');
let matchers = new MatcherCollection([/foo/, 'bar']);
console.log(matchers.match('foobar')); // true
console.log(matchers.match('barbaz')); // true
console.log(matchers.match('quxfoo')); // true
console.log(matchers.match('qux')); // false
Micromatch is a highly optimized wildcard and glob matching library. It is more feature-rich than matcher-collection, supporting a broader range of pattern matching options, including advanced globbing.
Anymatch is a package that allows you to match strings against a mixture of strings, regexes, and functions. It provides a similar functionality to matcher-collection but also allows for matching using custom test functions.
Multimatch extends the capabilities of micromatch by allowing multiple patterns to be matched against multiple strings. It is similar to matcher-collection in that it deals with collections of patterns, but it is built on top of micromatch for more powerful pattern matching.
Minimatch but for collections of minimatcher matchers.
yarn add matcher-collection
const MatcherCollection = require('matcher-collection')
const m = new MatcherCollection([
'tests/',
'**/*.js',
]);
m.match('tests/foo.js') // => true
m.match('foo.js') // => false
m.mayContain('tests') // => true
m.mayContain('foo') // => false
FAQs
Minimatch but for collections of minimatcher matchers.
The npm package matcher-collection receives a total of 1,036,585 weekly downloads. As such, matcher-collection popularity was classified as popular.
We found that matcher-collection demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.